var useraccountcontroller = {

       saveUserData : function(){
            var txtUsername = $.mobile.activePage.find('#txtUsername').val();
            var txtEmail = $.mobile.activePage.find('#txtEmail').val();
            if(localStorage.getItem("username") === null){
                localStorage.setItem("username", txtUsername);
            }
            if(localStorage.getItem("user_email") === null){
                localStorage.setItem("user_email", txtEmail);
            }
       },

       setPhotoFromGravatar : function(){
           var email = $.mobile.activePage.find('#txtEmail').val();
           var urlGravatar = "http://www.gravatar.com/avatar/" + md5Calculator.md5(email);

           var c = $.mobile.activePage.find('#profileImage');
           var ctx = c[0].getContext("2d");
           var img = new Image;
           img.crossOrigin = 'anonymous';
           img.onload = function(){
                ctx.drawImage(img,0,0);
                if(localStorage.getItem("pushups_profile_img") === null){
                    localStorage.setItem("pushups_profile_img", c[0].toDataURL("image/png"));
                }
           };
           img.src = urlGravatar;
       }
};